if !has("gui_running")
    finish
endif

amenu &heefan.&General.Set\ Tab\ Shift\ As\ 4     :call HFSetIndent()<CR>
amenu &heefan.&General.Text\ format\ with\ OS    :call HFFileFormatWithOS()<CR>
amenu &heefan.&General.Search\ Method            :call HFSetSearch()<CR>
amenu &heefan.&General.Remove\ Toolbar           :set guioptions+=m<CR>
amenu &heefan.&General.Set\ status\ bar           :
amenu &heefan.&General.Show\ Tab\ Space           :set listchars=tab:>-,trail:~<CR>
amenu &heefan.&General.Show\ color\ column\ as\ 100  :call HFSetColorColumn()<CR>

amenu &heefan.&Text\ Foramt.Remove\ ^M   :%s/<C-v-m>//g<CR>
amenu &heefan.&Text\ Foramt.Replace\ tab\ as\ space  :call HFReplaceTabAsSpace()<CR>
amenu &heefan.&Text\ Foramt.Replace\ as\ tab  :call HFReplaceSpaceAsTab()<CR>

function! HFSetIndent()
    echo "tabstop=4,autoindent,shiftwidth=4"
    set tabstop=4
    set autoindent
    set shiftwidth=4
endfunction

function! HFFileFormatWithOS()
    if has("unix")
        echo "set ff=unix"
        set fileformat=unix
    elseif has("win32")
        echo "set ff=dos"
        set fileformat=dos
    endif
endfunction

function! HFSetSearch()
    echo "set hlsearch,incsearch"
    set hlsearch
    set incsearch
endfunction

function! HFReplaceTabAsSpace()
    echo "set expantab; %!retab!"
    set expandtab
    %retab!
endfunction

function! HFReplaceSpaceAsTab()
    echo "set noexpantab; %retab!"
    set noexpandtab
    %retab!
endfunction

function! HFSetColorColumn()
    highlight OverLength ctermbg=red ctermfg=white guibg=#592929
    match OverLength /\%100v.*/
    set colorcolumn=100
endfunction
